//queue.js
const app=getApp();

Page({

  data: {
    cliState: -1,
    array:null,
    navbarData: {
      showCapsule: false, //是否显示左上角图标   1表示显示    0表示不显示
      title: '用户列表', //导航栏 中间的标题
    },
    navHeight: app.globalData.statusBarHeight * 2 + 86,
  },
  onLoad(){
    var that = this;
    let {openid,accountId} = wx.getStorageSync('logindata')
    wx.request({
      // url: app.getUrl('/xcx/pt/getUsersInfo'),
      url: app.getUrl(`/xcx/pt/getUsersInfoByOpenId?openId=${openid}&accountId=${accountId}`),
      method: 'GET',
      header: wx.getStorageSync('cookie'),
      success(res) {
        wx.showLoading({
          title: '加载中',
          mask: true
        })
        setTimeout(function () {
          wx.hideLoading()
        }, 500)
        if (res.data.code == 0) {
          that.setData({
            array: res.data.data
          })
        } else if (res.data.code == 200) {
          that.setData({
            array: res.data.data
          })
          setTimeout(function () {
            wx.navigateTo({
              url: "../queue_list/queueList?ptUserId=" + res.data.data[0].id,
            })
          },500)
        } else if (res.data.code == 404){
          wx.navigateTo({
            url: '../queue/queue?code=true',
          })
        }
      }
    })
  },
  // 点击改变当前view 的class
  changeClick: function(e) {
    var _this = this;
    _this.setData({ //把选中值放入判断值
      cliState: e.currentTarget.dataset.id
    })
    // 跳转到队列列表
    wx.navigateTo({
      url: "../queue_list/queueList?ptUserId=" + e.currentTarget.dataset.id,
    })  
  },
})